home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual 78 / CD Actual 78 Mayo 2003.iso / Linux / LinuxGazette / lg / issue89 / misc / danguer / documents_for.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2003-02-22  |  1.8 KB  |  67 lines

  1. <!-- documents.xsl -->
  2. <xsl:stylesheet version="1.0"
  3.                   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4.  
  5. <xsl:template match="/"> 
  6.   <html> 
  7.     <head>
  8.       <title>My Documents</title>
  9.     </head>
  10.     
  11.     <body>
  12.       <xsl:apply-templates select="//document"/>
  13.     </body>
  14.   </html>
  15. </xsl:template>
  16.  
  17. <xsl:template match="document">
  18.   <xsl:variable name="doc_path">docs</xsl:variable>
  19.   <xsl:variable name="doc_subpath"><xsl:value-of select="module"/></xsl:variable>
  20.   <table width="100%">
  21.      <!-- I will omit all the "fashion" of the tables :-) -->
  22.       <tr>
  23.          <td>
  24.             <b>Title: <xsl:value-of select="title"/></b>
  25.          </td>
  26.      </tr>
  27.      <xsl:for-each select="author">
  28.      <tr>
  29.          <td>
  30.             Author: <xsl:apply-templates />
  31.          </td>
  32.       </tr>
  33.       </xsl:for-each>
  34.      <tr>
  35.          <td>
  36.             <table width="100%">
  37.                <tr>
  38.                   <td width="33%">
  39.                      <xsl:if test="format/@pdf = 'yes'">
  40.                        <a href="{$doc_path}/{$doc_subpath}/{$doc_subpath}.pdf">PDF</a>
  41.                      </xsl:if>
  42.                      <![CDATA[ ]]> <!-- blank space, so your browser could 
  43.                                              format perfectly if the 'xsl:if' fails -->
  44.                   </td>
  45.                   <td width="33%">
  46.                      <xsl:if test="format/@ps = 'yes'">
  47.                        <a href="{$doc_path}/{$doc_subpath}/{$doc_subpath}.ps">PS</a>
  48.                      </xsl:if>
  49.                      <![CDATA[ ]]> <!-- blank space, so your browser could 
  50.                                              format perfectly if the 'xsl:if' fails -->
  51.                   </td>
  52.                   <td width="33%">
  53.                      <xsl:if test="format/@html = 'yes'">
  54.                        <a href="{$doc_path}/{$doc_subpath}/{$doc_subpath}/">HTML (online)</a>
  55.                      </xsl:if>
  56.                      <![CDATA[ ]]> <!-- blank space, so your browser could 
  57.                                              format perfectly if the 'xsl:if' fails -->
  58.                   </td>
  59.                </tr>
  60.             </table>
  61.          </td>
  62.       </tr>
  63.   </table>
  64. </xsl:template>
  65.  
  66. </xsl:stylesheet>
  67.